home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / PPC1B3AA.ZIP / IEMSI.PPS < prev    next >
Text File  |  1996-08-29  |  19KB  |  540 lines

  1. ;----------------------------------------------------------------------------
  2. ; Copyright(C) 1996, The AEGiS Corporation
  3. ;----------------------------------------------------------------------------
  4. ;
  5. ; PROCEDURE Iemsi()
  6. ;
  7. ; Tests if user has IEMSI enabled (with Terminate for example)
  8. ; If IEMSI is available, information will be gathered and stored in
  9. ; Client... variables
  10. ;
  11. ; Note: IEMSI.MSG & IEMSI.CFG must be distributed along with your application
  12. ;
  13. ;----------------------------------------------------------------------------
  14. #lib
  15. #nouser
  16.  
  17. Declare Function IEMSI_TickNow() Long
  18. Declare Function IEMSI_CodeHiAscii(bigstr str) BigStr
  19. Declare Function IEMSI_DecodeHiAscii(bigstr str) BigStr
  20. Declare Function IEMSI_DosToUnix(Date curdat, Time curtim) UNSIGNED
  21. Declare Procedure IEMSI_UnixToDos(unsigned dat, Var Date newDate, Var Time NewTime)
  22. Declare Procedure IEMSI_WriteLog()
  23. Declare Procedure IEMSI_MakeISIPacket()
  24. Declare Procedure IEMSI_FlushModem()
  25. Declare Procedure Iemsi()
  26. ;----------------------------------------------------------------------------
  27. Boolean IEMSI_OK
  28. String IEMSI_ClientName
  29. String IEMSI_ClientPassword
  30. String IEMSI_ClientAlias
  31. String IEMSI_ClientLocation
  32. String IEMSI_ClientDataPhone
  33. String IEMSI_ClientVoicePhone
  34. String IEMSI_ClientBirthdate
  35. String IEMSI_ClientSoftware
  36. String IEMSI_LogFile
  37. String IEMSI_BoardName
  38. String IEMSI_SysopName
  39. String IEMSI_BoardLocation
  40. String IEMSI_CR
  41. BigStr EMSI_IRQ
  42. BigStr EMSI_ACK
  43. BigStr EMSI_NAK
  44. BigStr EMSI_ICI
  45. BigStr EMSI_ISI
  46. Long IEMSI_Crc
  47. Long IEMSI_XorRot
  48. Boolean IEMSI_CrkTerminate
  49.  
  50. Procedure Iemsi()
  51.  
  52. ;----------------------------------------------------------------------------
  53. String IemsiCopyright
  54. Integer Timer1
  55. Integer Timer2
  56. Integer Tries
  57. ;----------------------------------------------------------------------------
  58. unsigned t
  59. integer RcvTries
  60. Date newdat
  61. Time newtim
  62. String k
  63. BigStr RcvString
  64. BigStr TempString
  65. Integer Count
  66. Integer A
  67. unsigned unixdate
  68. long crc2
  69. ;----------------------------------------------------------------------------
  70. String Msg(12)
  71. ;----------------------------------------------------------------------------
  72.  
  73. IemsiCopyright = "φ AEGiS CoRP iEMSI iNTERFACE v1.2 φ By Lone Runner / AGS'96 φ" 
  74. IEMSI_CR = Chr(13)
  75. EMSI_IRQ = "**EMSI_IRQ8E08"+IEMSI_CR
  76. EMSI_ACK = "**EMSI_ACKA490"+IEMSI_CR
  77. EMSI_NAK = "**EMSI_NAKEEC3"+IEMSI_CR
  78. EMSI_ICI = "**EMSI_ICI"
  79.  
  80. If (onlocal()) Goto EndIemsi  
  81.  
  82. :tryiemsi
  83. IEMSI_LogFile = PPEPATH()+"IEMSI."+STRING(PCBNODE())
  84. If (Exist(IEMSI_LogFile)) Delete IEMSI_LogFile
  85.  
  86. Fopen 1, PPEPath() + "IEMSI.MSG", O_RD, S_DN
  87. For a = 1 to 12
  88. FGet 1, Msg(a)
  89. next
  90. FClose 1
  91.  
  92. IEMSI_BoardName = ReadLine(PPEPath()+"IEMSI.CFG",1)
  93. IEMSI_BoardLocation = ReadLine(PPEPath()+"IEMSI.CFG",2)
  94. IEMSI_SysopName = ReadLine(PPEPath()+"IEMSI.CFG",3)
  95. FClose -1
  96.  
  97. SprintLn Msg(12)
  98. while (outbytes() != 0) do
  99. endwhile
  100.  
  101. IEMSI_XorRot = S2i("FFFFFFFF",16)                         ; Init var XOR
  102.  
  103. SPrintLn Msg(1)              ; Advance session info
  104. Print ""
  105. Print IEMSI_CR
  106. MPrint EMSI_IRQ            ; Send IEMSI request
  107. MPrint "              "+IEMSI_CR ; Clear it in case no Iemsi is supported
  108.  
  109. Tries = 0                  ; Try #0!
  110.  
  111. RcvString = ""             ; Reset Buffer
  112.  
  113. ; Wait for Iemsi answer
  114. IEMSI_MakeISIPacket()                       ; Create EMSI_ISI packet (we use the delay
  115.                                             ; to lose as less time as possible)
  116. ;while (IEMSI_TickNow() < t + 36) do        ; If the packet creation took less that 2s
  117. ;endwhile                                   ; we complete the waiting
  118.                                             ;
  119.                                             ; ---> This seems to be unnecessary
  120.  
  121. :GetICI                    
  122. Inc Tries                                   ; New try
  123. If (Tries > 3) Goto EMSIFailed              ; If more that 3 tries IEMSI failure
  124.  
  125. t = IEMSI_TickNow()                         ; # of 1/18.2 since midnight
  126.  
  127. While (1) Do
  128.     k = MInkey()                            ; Read modem buffer
  129.     RcvString = RcvString + k               ; Add to the answer string
  130.     If (k = IEMSI_CR) Break                 ; If CR received, we have all !
  131.     if ((t+36 < IEMSI_TickNow()) && inbytes() = 0 ) break ; Goto nak1 ; No ? So we continue
  132.                                             ; with a timeout of 1s & a condition : no more
  133.                                             ; chars in the modem buffer
  134. EndWhile
  135.  
  136. If (RcvString = "") Goto noIemsi
  137.  
  138. If (len(RcvString) < 49) Then     ; If the length is < 49 we take the following
  139.     Goto GetICI                    ; part of it (49 = len of an empty packet)
  140. endif
  141.  
  142. ; Handle received Packet
  143. :handleICI
  144.  
  145.     SprintLn Msg(3) ; Advance session info
  146.  
  147.     A = s2i(mid(RcvString,11,4),16)           ; Get the Crc
  148.                                               ;
  149.     TempString = mid(RcvString,3,a+12)        ;
  150.     IEMSI_Crc = s2i(mid(RcvString,15+a,8),16) ;
  151.     crc2 = CRC32(CRC_STR,TempString)          ; Calculate real Crc from received pckt
  152.     crc2 = XOR(crc2,IEMSI_XorRot)             ;
  153.     if (IEMSI_Crc != crc2) goto nak1          ; Compare them
  154.    
  155.     TempString = RcvString                    ; Temporary string
  156.     
  157.     TempString = IEMSI_DecodeHiAscii(TempString) ; Decode Hiascii ("\00" = Chr(0))
  158.  
  159.     A = Instr(TempString,"{")
  160.     TempString = Mid(TempString,A+1,Len(TempString)-A)
  161.     A = Instr(TempString,"}")
  162.     IEMSI_ClientName = Left(TempString,A-1)       ; User's Name !
  163.     
  164.     A = Instr(TempString,"{")
  165.     TempString = Mid(TempString,A+1,Len(TempString)-A)
  166.     A = Instr(TempString,"}")
  167.     IEMSI_ClientAlias = Left(TempString,A-1)      ; User's Alias !
  168.     
  169.     A = Instr(TempString,"{")
  170.     TempString = Mid(TempString,A+1,Len(TempString)-A)
  171.     A = Instr(TempString,"}")
  172.     IEMSI_ClientLocation = Left(TempString,A-1)   ; User's Location !
  173.  
  174.     A = Instr(TempString,"{")
  175.     TempString = Mid(TempString,A+1,Len(TempString)-A)
  176.     A = Instr(TempString,"}")
  177.     IEMSI_ClientDataPhone = Left(TempString,A-1)  ; User's Dataphone !
  178.  
  179.     A = Instr(TempString,"{")
  180.     TempString = Mid(TempString,A+1,Len(TempString)-A)
  181.     A = Instr(TempString,"}")
  182.     IEMSI_ClientVoicePhone = Left(TempString,A-1) ; User's Voicephone !
  183.  
  184.     A = Instr(TempString,"{")
  185.     TempString = Mid(TempString,A+1,Len(TempString)-A)
  186.     A = Instr(TempString,"}")
  187.     IEMSI_ClientPassword = Left(TempString,A-1)   ; User's Password !
  188.     
  189.     A = Instr(TempString,"{")
  190.     TempString = Mid(TempString,A+1,Len(TempString)-A)
  191.     A = Instr(TempString,"}")
  192.     IEMSI_ClientBirthdate = Left(TempString,A-1)  ; User's Date of Birth !
  193.     if (IEMSI_ClientBirthdate != "") Then
  194.         unixdate=S2i(IEMSI_ClientBirthdate,16)    ; Convert UnixDate -> DosDate
  195.         IEMSI_UnixToDos(unixdate,newdat,newtim)
  196.         IEMSI_ClientBirthdate = String(newdat)    ; End Convertion
  197.     endif
  198.     
  199.     ; Didn't use a loop here so you can do exactly what you want with
  200.     ; the received packet. \/
  201.  
  202.     A = Instr(TempString,"{")                ; Jump one field
  203.     TempString = Mid(TempString,A+1,Len(TempString)-A)
  204.     A = Instr(TempString,"{")                ; Jump one field
  205.     TempString = Mid(TempString,A+1,Len(TempString)-A)
  206.     A = Instr(TempString,"{")                ; Jump one field
  207.     TempString = Mid(TempString,A+1,Len(TempString)-A)
  208.     A = Instr(TempString,"{")                ; Jump one field
  209.     TempString = Mid(TempString,A+1,Len(TempString)-A)
  210.  
  211.     A = Instr(TempString,"{")
  212.     TempString = Mid(TempString,A+1,Len(TempString)-A)
  213.     A = Instr(TempString,"}")
  214.     IEMSI_ClientSoftware = Left(TempString,A-1)   ; User's Software !
  215.     
  216.     if (instr(Chr(0)+" .",Right(IEMSI_ClientName,1))) then                  ; Does the name ends
  217.         IEMSI_ClientName = Left(IEMSI_ClientName, Len(IEMSI_ClientName)-1)  ; with a "." ?
  218.         IEMSI_CrkTerminate = True                                           ; Yes, so it's a 
  219.     endif                                                                   ; cracked terminate :)
  220.     
  221.     If (Trim(IEMSI_ClientName, " ") = "") Then  ; If the User's Name = "" so :
  222.         Goto emsiFailed                         ; IEMSI failed
  223.     else
  224.                                                 ; Else, display received 
  225.                                                 ; informations on the local 
  226.                                                 ; screen only!
  227.         SPrintLn                                   "******************************************************************************"
  228.         If (IEMSI_ClientName != "") SPrintLn       "Name       : " + mid(IEMSI_ClientName,1,62)
  229.         If (IEMSI_ClientPassword != "") SPrintLn   "Password   : " + mid(IEMSI_ClientPassword,1,62)
  230.         If (IEMSI_ClientAlias != "") SPrintLn      "Alias      : " + mid(IEMSI_ClientAlias,1,62)
  231.         If (IEMSI_ClientLocation != "") SPrintLn   "Location   : " + mid(IEMSI_ClientLocation,1,62)
  232.         If (IEMSI_ClientDataPhone != "") SPrintLn  "Data Phone : " + mid(IEMSI_ClientDataphone,1,62)
  233.         If (IEMSI_ClientVoicePhone != "") SPrintLn "Voice Phone: " + mid(IEMSI_ClientVoicePhone,1,62)
  234.         If (IEMSI_ClientBirthdate != "") SPrintLn  "Birthdate  : " + mid(IEMSI_ClientBirthdate,1,62)
  235.         If (IEMSI_ClientSoftware != "") SPrintLn   "Software   : " + mid(IEMSI_ClientSoftware,1,62)
  236.         If (IEMSI_CrkTerminate) SprintLn           "Using Cracked Version of Terminate !"
  237.         SPrintLn                             "******************************************************************************"
  238.         Goto replyISI                         ; and go to answer!
  239.     endif
  240.  
  241.  
  242. :nak1
  243.                                             ; Crc were different !
  244. SprintLn Msg(5)                               ; Advance session info
  245. MPrint EMSI_NAK                             ; Send a NAK !
  246. Goto GetICI                                 ; Go back to receive the packet
  247.  
  248.  
  249. :replyISI
  250.                                             ; Client packet received, sending
  251.                                             ; the server packet
  252.     SprintLn Msg(6)                         ; Advance session info
  253.     
  254.     Tries = 0                                 ; Try #0
  255.     
  256.                                             ; Begin sending
  257.     :SendISI
  258.     SprintLn Msg(7)                         ; Advance session info
  259.     
  260.     MPrint EMSI_ISI                         ; Send EMSI_ISI (server package)
  261.     
  262.     ;Delay 25                                ; ---> This was unnecessary...
  263.  
  264.     Inc Tries                                 ; Inc tries
  265.     If (Tries > 3) Goto EMSIFailed             ; If tries > 3 so IEMSI failed!
  266.  
  267.     RcvString = ""                             ; Reset reception buffer
  268.     t = IEMSI_TickNow()                     ; # of 1/18.2 since midnight
  269.     rcvTries=1                                 ; Reception try #1
  270.  
  271. :waitACK
  272.                                             ; Waiting for ACK (EMSI ACKNOLEDGE)
  273.     While (1) Do
  274.         k = MInkey()                         ; Take an incoming modem char
  275.         RcvString = RcvString + k             ; Add it to the buffer
  276.         If (k = IEMSI_CR) Break             ; If CR, so we have all
  277.         If ((t+36 < IEMSI_TickNow()) && inbytes() = 0) break
  278.                                             ; If no CR, we wait
  279.                                             ; with a timeout of
  280.                                             ; 4s & condition:
  281.                                             ; modem buffer empty
  282.     EndWhile
  283.     
  284.     if (len(RcvString) < 15) then ; If len(buffer) < 15 (len of NAK & ACK)
  285.         Inc rcvTries              ; so inc RcvTries
  286.         if (rcvTries < 4) then    ; If no 3 tries to receive,
  287.             goto waitACK          ; so we go back to wait for the ACK
  288.         else
  289.             goto SendISI          ; Else, resend the ISI packet
  290.         endif
  291.     endif
  292.  
  293.     If (Instr(RcvString,EMSI_NAK) != 0) Then ; Did we get a NAK ?
  294.         SprintLn Msg(8)                      ; Yes! so advance session info
  295.         IEMSI_MakeISIPacket()
  296.         Goto SendISI                         ; and resend ISI packet
  297.     endif
  298.     
  299.     if (Instr(RcvString,EMSI_ACK) != 0) Then ; Did we get an ACK ?
  300. :finiemsi
  301.         SprintLn Msg(9)             ; Yes! So advance session info
  302.         SprintLn Msg(10)            ; Advance session info (again, sorry ;)
  303.  
  304.         delay 4                       ; delay 4/18.2s (the users has an IEMSI)
  305.                                       ; window showing the server informations)
  306.                                      ; ---> This is optionnal of course.
  307.         IEMSI_OK = True
  308.         
  309.         IEMSI_WriteLog()                            ; Write the log.
  310.         IEMSI_FlushModem()                          ; Flush input buffer, just in case...
  311.         Goto Endiemsi                               ; Go back to normal login
  312.     else                                             ; Did not get the ACK ?
  313.         Goto SendISI                                ; so resend ISI!
  314.     EndIf
  315.  
  316. :EMSIFailed
  317.                                                     ; IEMSI Failed
  318.                                                     ; Writing log
  319.                                                     ; WARNING: We do not write
  320.                                                     ; in the CALLERx. system log,
  321.                                                     ; it's not possible if we are in
  322.                                                     ; some special types of login PPE...
  323.  
  324. FOPEN 1,IEMSI_LogFile,O_WR,S_DN
  325. fputln 1, "**************************************************************"
  326. fputln 1, "IEMSI HANDSHAKE FAILURE"
  327. fputln 1, "**************************************************************"
  328. fclose 1
  329. SprintLn Msg(11)                                     ; Advance session info
  330. delay 5
  331. IEMSI_FlushModem()                                  ; Flush the modem
  332. Goto EndIemsi                                       ; Return to normal login
  333.  
  334. :NoIemsi
  335.                                                     ; No IEMSI Capabilities
  336.                                                     ; Write the log
  337. FOPEN 1,IEMSI_LogFile,O_WR,S_DN
  338. fputln 1, "**************************************************************"
  339. fputln 1, "NO IEMSI CAPABILITIES"
  340. fputln 1, "**************************************************************"
  341. fclose 1
  342. SprintLn Msg(4)                                     ; Advance session info
  343. delay 5
  344.  
  345. :EndIemsi
  346.  
  347. EndProc ; End of code!
  348.  
  349. ;----------------------------------------------------------------------------
  350. ; This function returns the # of CPU ticks since midnight
  351. ;
  352. Function IEMSI_TickNow() LONG 
  353. IEMSI_TickNow = PeekDW(MKADDR(0040h,006Ch))
  354. EndFunc
  355.  
  356. ;----------------------------------------------------------------------------
  357. ; This function codes Hiascii's (Chr(0) -> "\00")
  358. ;
  359. Function IEMSI_CodeHiAscii(Bigstr str) BigStr 
  360.  
  361. String Temp
  362. word c
  363.  
  364. Temp = ""
  365. for c = 1 to len(str)
  366.     if (asc(mid(str,c,1)) <= 127 || mid(str,c,1) = "\") then
  367.         Temp = Temp + mid(str,c,1)
  368.     else
  369.         Temp = Temp + "\"+i2s(asc(mid(str,c,1)),16)
  370.     endif
  371. Next            
  372. IEMSI_CodeHiAscii = Temp
  373. Endfunc
  374.  
  375. ;----------------------------------------------------------------------------
  376. ; This function decodes Hiascii's ("\00"->Chr(0))
  377. ;
  378. Function IEMSI_DecodeHiAscii(Bigstr str) BigStr 
  379.  
  380. String Temp
  381. word c
  382.  
  383. Temp = ""
  384. for c = 1 to len(str)
  385.     if (mid(str,c,1) != "\") then
  386.         Temp = Temp + mid(str,c,1)
  387.     else
  388.         Temp = Temp + chr(S2i(mid(str,c+1,2),16))
  389.         c = c + 2
  390.     endif
  391. Next            
  392. IEMSI_DecodeHiAscii = Temp
  393. Endfunc
  394.  
  395. ;----------------------------------------------------------------------------
  396. ; Write the log in a temporary file because it's not possible to write 
  397. ; in the log at this location of PCB...
  398. ;
  399. Procedure IEMSI_WriteLog() 
  400. Fcreate 1,IEMSI_LogFile,O_WR,S_DN
  401. fputln 1,                                   "**************************************************************"
  402. If (IEMSI_ClientName != "") fputln 1,       "Name       : " + IEMSI_ClientName
  403. If (IEMSI_ClientPassword != "") fputln 1,   "Password   : " + IEMSI_ClientPassword
  404. If (IEMSI_ClientAlias != "") fputln 1,      "Alias      : " + IEMSI_ClientAlias
  405. If (IEMSI_ClientLocation != "") fputln 1,   "Location   : " + IEMSI_ClientLocation
  406. If (IEMSI_ClientDataPhone != "") fputln 1,  "Data Phone : " + IEMSI_ClientDataphone
  407. If (IEMSI_ClientVoicePhone != "") fputln 1, "Voice Phone: " + IEMSI_ClientVoicePhone
  408. If (IEMSI_ClientBirthdate != "") fputln 1,  "Birthdate  : " + IEMSI_ClientBirthdate
  409. If (IEMSI_ClientSoftware != "") fputln 1,   "Software   : " + IEMSI_ClientSoftware
  410. If (IEMSI_CrkTerminate) fputln 1,           "Using Cracked Version of Terminate !"
  411. fputln 1,                                   "**************************************************************"
  412. fclose 1
  413. EndProc
  414.  
  415. ;--------------------------------------------------------------------------
  416. ; DOSdate&time -> UNIXdate&time
  417. ;
  418. Function IEMSI_DosToUnix(Date curdat, Time curtim) UNSIGNED 
  419. int annee
  420. int jour
  421. int mois
  422. unsigned dat
  423.  
  424. Jour = Day(curdat)
  425. Mois = Month(curdat)
  426. Annee = Year(curdat)-1968
  427.  
  428. if (annee % 4 = 0) then
  429.     select case Mois
  430.         case 2
  431.             jour = jour + 31
  432.         case 3
  433.             jour = jour + 60
  434.         case 4
  435.             jour = jour + 91
  436.         case 5
  437.             jour = jour + 121
  438.         case 6
  439.             jour = jour + 152
  440.         case 7
  441.             jour = jour + 182
  442.         case 8
  443.             jour = jour + 213
  444.         case 9
  445.             jour = jour + 244
  446.         case 10
  447.             jour = jour + 274
  448.         case 11
  449.             jour = jour + 305
  450.         case 12
  451.             jour = jour + 335
  452.     end select                                      
  453. else
  454.     select case Mois
  455.         case 2
  456.             jour = jour + 31
  457.         case 3
  458.             jour = jour + 59
  459.         case 4
  460.             jour = jour + 90
  461.         case 5
  462.             jour = jour + 120
  463.         case 6
  464.             jour = jour + 151
  465.         case 7
  466.             jour = jour + 181
  467.         case 8
  468.             jour = jour + 212
  469.         case 9
  470.             jour = jour + 243
  471.         case 10
  472.             jour = jour + 273
  473.         case 11
  474.             jour = jour + 304
  475.         case 12
  476.             jour = jour + 334
  477.     end select                                      
  478. end if
  479.  
  480. dat = jour * 86400 + (annee - 2) * 365 * 86400 + (annee/4)*86400 + curtim
  481. IEMSI_DosToUnix = dat
  482. EndFunc
  483. ;----------------------------------------------------------------------------
  484. ; UNIX Date&time -> DOSdate&time
  485. ;
  486. Procedure IEMSI_UnixToDos(unsigned dat, Var Date newDate, Var Time NewTime)
  487. int annee
  488. int jour
  489. int heure
  490. int minute
  491. int mois
  492. unsigned seconde
  493.  
  494. seconde = dat % 86400
  495. dat = dat / 86400
  496.  
  497. annee = (dat / 365)+2
  498.  
  499. jour = dat % 365 - annee/4
  500. inc jour
  501.  
  502. NewDate = Jour + (Annee+68) * 365 + 17
  503. NewTime = Seconde
  504. EndProc
  505.  
  506. ;----------------------------------------------------------------------------
  507. ; Making of the EMSI_ISI packet (SERVER PACKAGE)
  508. ;
  509. Procedure IEMSI_MakeISIPacket()
  510.  
  511. BigStr TempString
  512. String Temp
  513.  
  514.     EMSI_ISI = "EMSI_ISI"
  515.     TempString = "{PCBoard v"+ left(string(Ver()),2)+"."+mid(string(Ver()),3,1)
  516.     if (mid(string(Ver()),4,1) != "0") TempString = Tempstring + mid(string(Ver()),4,1)
  517.     TempString = TempString + "/"+string(MaxNode()) + "}{" + IEMSI_BoardName + "}{" + IEMSI_BoardLocation + "}{" + IEMSI_SysopName + "}{"+ I2s(IEMSI_DosToUnix(Date(), Time()),16) + "}{IEMSI Engine 1.2 (C)AEGiS}{\01}{}"
  518.     TempString = IEMSI_CodeHiAscii(TempString)
  519.     Temp = I2S(Len(TempString)+TempString,16)
  520.     While (len(Temp) < 4) do
  521.     Temp = "0"+Temp
  522.     EndWhile
  523.     EMSI_ISI = EMSI_ISI + Temp + TempString
  524.     IEMSI_Crc=CRC32(CRC_STR,EMSI_ISI)
  525.     IEMSI_Crc=XOR(IEMSI_Crc,IEMSI_XorRot)
  526.     EMSI_ISI = "**" + EMSI_ISI + I2S(IEMSI_Crc,16)+IEMSI_CR
  527. EndProc
  528.  
  529. ;----------------------------------------------------------------------------
  530. ; Flush the incoming buffer
  531. ;
  532. Procedure IEMSI_FlushModem()
  533. String k
  534.  
  535. While (inbytes() > 0) do                
  536.     k = minkey()                        
  537. Endwhile
  538. Endproc
  539.  
  540.